<template>
  <div>
<h1>登录</h1>
    <table class="table table-bordered">
      <tbody>
      <tr>
        <td>用户名</td>
        <td><input type="text" v-model="info.name"/></td>
      </tr>
      <tr>
        <td>密码</td>
        <td><input type="password" v-model="info.pwd"/></td>
      </tr>
      <tr>
        <td></td>
        <td><input type="button" value="登录" class="btn btn-success" @click="log"/></td>
      </tr>
      </tbody>
    </table>
  </div>
</template>

<script setup lang="ts">
import {ref,reactive,onMounted} from 'vue'
import axios from "axios";
import moment from "moment";
import {useRoute,useRouter} from "vue-router";

const router = useRouter()
const route = useRoute()

let info:any=reactive({
  name:"",
  pwd:"",
})
const log=()=>{
  axios({
    url:"https://localhost:7032/api/User/Login",
    method:"get",
    params:info
  }).then((res:any)=>{
    console.log(res)
    if(res.data==-1){
      alert("用户名不存在")
      return;
    }
    if(res.data>0){
      alert("登录成功")
    }
    else
    {
      alert("登录失败")
      return;
    }
  })
}
</script>

<style lang="scss" scoped>

</style>